//
//  ChangePsdViewController.m
//  ai2ban
//
//  Created by Heartbeats on 2018/1/21.
//  Copyright © 2018年 mac book pro. All rights reserved.
//

#import "ChangePsdViewController.h"

@interface ChangePsdViewController ()
@property (weak, nonatomic) IBOutlet UITextField *nowPsdTextFile;
@property (weak, nonatomic) IBOutlet UITextField *configPsdTextFile;
@property (weak, nonatomic) IBOutlet UITextField *xingPsdT;
@property (weak, nonatomic) IBOutlet UIButton *submitBtn;

@end

@implementation ChangePsdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"密码设置";
    self.submitBtn.layer.cornerRadius = 8;
    self.submitBtn.clipsToBounds = true;
}

- (IBAction)submitAction:(UIButton *)sender {
    if ([self.nowPsdTextFile.text isNull] || [self.configPsdTextFile.text isNull] || [self.xingPsdT.text isNull]) {
        [MozTopAlertView showWithType:MozAlertTypeInfo text:@"请填写密码" parentView:nil];
        return;
    }
    NSDictionary *param = @{@"userId": AppManager.user.userId, @"nowPassword": self.nowPsdTextFile.text, @"newPassword": self.xingPsdT.text, @"confirmPwd": self.configPsdTextFile.text};
    [[NetworkManager shareNetwork] requestWithURLString:@"app/system/editPsw" parameters:param method:@"POST" callBack:^(id responseObject) {
        if ([responseObject[@"state"] intValue]) {
            [MozTopAlertView showWithType:MozAlertTypeInfo text:@"修改密码成功" parentView:nil];
            [self.navigationController popViewControllerAnimated:true];
            return;
        }
        [MozTopAlertView showWithType:MozAlertTypeInfo text:responseObject[@"info"] parentView:nil];
    }];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
//    app/system/editPsw
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
